#include<iostream>
#include<string>
#include<list>
using namespace std;
int main()
{
    string s;
    while (cin >> s) {
        if (s.size() == 1)
            cout << s;
        else if (s.size() == 0)
            cout << 0;
        else {
            int next = 1;
            int prve = 0;
            while (next < s.size() && s.size() >= 2) {
                if (s[next] == s[prve]) {
                    s.erase(prve, 2);
                    next = 1;
                    prve = 0;
                }
                else {
                    next++;
                    prve++;
                }
            }
            cout << s;
        }
    }
    return 0;
}
